#define _CRT_SECURE_NO_WARNINGS 1
#define Max 15
typedef struct mystack
{
    int* data;
    int size;
}mystack;

void dfs(int n, mystack* a, mystack* b, mystack* c)
{
    if (n == 1)
    {
        c->data[c->size++] = a->data[--a->size];
        return;
    }
    else
    {
        dfs(n - 1, a, c, b);
        dfs(1, a, b, c);
        dfs(n - 1, b, a, c);
    }
}

void hanota(int* A, int ASize, int* B, int BSize, int** C, int* CSize) {
    if (ASize <= 0)
        return;
    mystack x, y, z;
    x.data = A;
    x.size = ASize;
    y.data = (int*)malloc(sizeof(int) * Max);
    y.size = 0;
    z.data = (int*)malloc(sizeof(int) * Max);
    z.size = 0;
    dfs(ASize, &x, &y, &z);
    *C = z.data;
    *CSize = ASize;
    free(y.data);
    y.data = NULL;
}